package com.lz.service.security.config;

import com.lz.common.annotation.AnonymousAccess;
import com.lz.common.annotation.PreventDuplicateSubmit;
import com.lz.common.utils.SecurityUtil;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.annotation.WebFilter;

@RestController
@RequestMapping
@AnonymousAccess
public class TestC {
    @PreventDuplicateSubmit
    @RequestMapping("/testC")
    public String testC() {
        SecurityContext context = SecurityContextHolder.getContext();
        String id = SecurityUtil.getId();
        System.out.println(id);

        System.out.println(context.getAuthentication().getPrincipal());
        return "testC";
    }

}
